<?php


namespace Part25_ResponsibilityChainModel\Code1;

require_once '../../autoload.php';

$m = new ConcreteMediator();

// 让两个具体同事类认识中介者对象
$c1 = new ConcreteColleague1($m);
$c2 = new ConcreteColleague2($m);

// 让中介者认识具体的同事类对象
$m->setColleague1($c1);
$m->setColleague2($c2);

// 具体同事类对象的发送信息是通过中介者转发
$c1->send('吃过饭了吗？');
$c2->send('没有呢，你请客吗？');